package com.landtool.utils;


import cn.hutool.json.JSONArray;

import java.io.IOException;

public class ZmqTest {

    public static void main(String[] args) throws IOException {

        int[] a = {1, 3, 4, 6, 7, 8, 9, 10, 11, 12, 14};
        int[] b = {1, 2, 6, 7, 8, 9, 14};
        System.out.println(updata(b, a));
    }


    public static JSONArray updata(int[] list1, int[] list2) {
        JSONArray list3 = new JSONArray();
        int pointerB = 0;
        for (int i = 0; i < list2.length; i++) {
            int obj2 = list2[i];
            for (int j = pointerB; j < list1.length; j++) {
                int obj1 = list1[j];
                if (obj1 > obj2) break;
                pointerB++;
                if (obj1 == obj2) {
                    list3.add(obj2);
                    break;
                }
            }
        }
        return list3;
    }

}
